Embodiments of the invention relate to memory devices, and in particular, to reducing write amplification in a cache with flash memory used as a write cache.
A cache is a small, high-speed memory device interposed between a processor and a larger but slower device, such as main memory or storage. Caches temporarily store data that are frequently accessed by applications executing on a processor. Data typically reside in a cache after an initial access to data from main memory or storage. Subsequent accesses to the same data are made to the cache. A cache allows for the data to be accessed in a shorter amount of time by reducing the number of wait states during data accesses.
Flash memory is a type of non-volatile memory that has low power and high-density. In particular, flash memory is a type of Electrically Erasable Programmable Read Only Memory (EEPROM) device that can be electrically erased and reprogrammed in blocks. Flash memory has features of the Random Access Memory (RAM) because data are rewritable on flash memory. Flash memory also has features of Read Only Memory (ROM) because flash memory devices are non-volatile. Memory cells are arranged in blocks for erasure, and after a block has been erased, the block is available to be reprogrammed. Flash memory has become an increasingly popular form of non-volatile memory because of the flash memory's small size, fast access speeds, shock resistance, and light weight.
Write amplification is a process that occurs when data are written to solid-state memory arrays. A memory array scans for free space in the memory array, when data are written to the array. Free space in a memory array includes individual cells, pages, and/or blocks of memory cells that are not programmed. Data are written to free space in the memory array, if there is enough free space to write the data. The data in a memory array is rearranged, if there is not enough free space in one location. Data in a memory array is rearranged by erasing, moving, and rewriting the data to a new location within the same memory array. Garbage collection is the process of identifying blocks with valid data for erasure and relocation.
Write amplification is the process of rearranging old data in a memory array. Rearrangement of data leaves free space for new data that is to be written in the memory array. The amount of write operations memory arrays must do in order to write new data are amplified based upon the amount of free space in the memory array and the size of the new data that is to be written on the memory array. Write amplification can be reduced by an increase in the amount of space on a memory array designated as free space, because less data will have to be rearranged. Performance of flash memory degrades, as a substitute or a supplement to DRAM in a cache, as a result of write amplification because write locations are random in typical caching environments.